package bigoo.peer.message;

import bigoo.common.communication.AbstractMessage;
import bigoo.common.communication.InvalidMessageException;
import bigoo.common.communication.Message;
import bigoo.common.communication.MessageBuilder;

public class GetPeersMessage extends AbstractMessage {

    public static final String MSG_IDENTIFIER = "GET_PEERS";


    public GetPeersMessage(String senderID) {
	super(senderID, MSG_IDENTIFIER);
    }

    @Override
    public String getRawMessage() {
	return this.getSenderID() + SEPARATOR + MSG_IDENTIFIER+SEPARATOR+END_OF_MESSAGE;
    }


    public static class Builder implements MessageBuilder {
	@Override
	public Message parseMessage(String rawMessage) throws InvalidMessageException {
	    String senderID = parseSenderID(rawMessage);
	    return new GetPeersMessage(senderID);
	}
    }
}
